﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="VideoClips.aspx.cs" Inherits="Framework.WebmasterTool.VideoClips" %>

<%@ Register Src="../Controls/simpleImageUploadUserControl/SimpleImageUpload.ascx" TagName="SimpleImageUpload"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chkAll").live("change", function () {
                if ($(this).is(":checked")) {
                    $(".checkbox").attr("checked", "checked");
                }
                else {
                    $(".checkbox").removeAttr("checked");
                }
            });
            $(".checkbox").live("click", function () {
                var allCheck = true;
                $(".checkbox").each(function () {
                    if (!$(this).is(":checked")) {
                        allCheck = false;
                        return;
                    }
                });
                if (allCheck == true) {
                    $("#chkAll").attr("checked", "checked");
                }
                else {
                    $("#chkAll").removeAttr("checked");
                }
            });
            $("#<%= btnDelete.ClientID %>").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                function (r) {
                    if (r) {
                        __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                    }
                });
                return false;
            });
            $("#<%= btnDeleteVideo.ClientID %>").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                function (r) {
                    if (r) {
                        __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                    }
                });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Quản lý bài viết Video
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div style="margin-bottom: 10px; border-bottom: solid 1px #ccc; width: 100%">
        </div>
        <div style="float: left; width: 350px; padding: 10px; border: solid 1px #ccc; background: #fff;
            margin-right: 10px; line-height: 22px">
            <div id="divMediaPlayer" runat="server" style="width: 350px; height: auto; margin-bottom: 10px">
                <embed id="MediaPlayer" allowfullscreen="true" allowscriptaccess="always" flashvars="width=350&amp;height=300&amp;file=flash/flash.flv"
                    height="300" name="MediaPlayer" quality="high" src="../Plugins/JwPlayer/player.swf"
                    style="" type="application/x-shockwave-flash" width="350" wmode="transparent"></embed>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Tên video clip:</span>
                <asp:TextBox ID="txtTitleVideo" runat="server" Width="200px" CssClass="textbox" Style="float: left"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Nhập tên clip."
                    ControlToValidate="txtTitleVideo" SetFocusOnError="True" ValidationGroup="Video"
                    Display="Dynamic">*</asp:RequiredFieldValidator>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Tên tiếng anh:</span>
                <asp:TextBox ID="txtTitleVideo_en" runat="server" Width="200px" Style="float: left"></asp:TextBox>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Danh mục:</span>
                <asp:DropDownList runat="server" ID="ddlCategories" Width="150px">
                </asp:DropDownList>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Ngày đăng:</span>
                <asp:Label ID="lblAddedDate" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Người đăng:</span>
                <asp:Label ID="lblAddedBy" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Ngày Update:</span>
                <asp:Label ID="lblUpdatedDate" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Người Update:</span>
                <asp:Label ID="lblUpdatedBy" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                   Mô tả:</span>
                <div style="float: left;">
                    <CKEditor:CKEditorControl ID="txtSummary" runat="server" UIColor="#CED9F3"
                        Width="250" Height="100" Toolbar="Basic" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                        TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js">
                    </CKEditor:CKEditorControl>
                </div>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                   Mô tả tiếng anh:</span>
                <div style="float: left;">
                    <CKEditor:CKEditorControl ID="txtSummary_en" runat="server" UIColor="#CED9F3"
                        Width="250" Height="100" Toolbar="Basic" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                        TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js">
                    </CKEditor:CKEditorControl>
                </div>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                    Chi tiết:</span>
                <div style="float: left;">
                    <CKEditor:CKEditorControl ID="txtDescription" runat="server" UIColor="#CED9F3" Width="250"
                        Height="100" Toolbar="Full" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                        TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js">
                    </CKEditor:CKEditorControl>
                </div>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                    Chi tiết tiếng anh:</span>
                <div style="float: left;">
                    <CKEditor:CKEditorControl ID="txtDescription_en" runat="server" UIColor="#CED9F3"
                        Width="250" Height="100" Toolbar="Full" BasePath="/Plugins/Ckeditor" ContentsCss="/Plugins/Ckeditor/contents.css"
                        TemplatesFiles="/Plugins/Ckeditor/plugins/templates/templates/default.js">
                    </CKEditor:CKEditorControl>
                </div>
            </div>
            <div style="float: left; width: 355px; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Hình đại diện:</span>
                <div style="float: left;">
                    <uc1:SimpleImageUpload ID="siuImage" runat="server" CssClass="ImageUpload" AutoOpenImageEditPopupAfterUpload="true" />
                </div>
            </div>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                        <span style="color: #555; float: left; display: block; width: 100px">Loại Upload:</span>
                        <asp:RadioButton ID="rdbUploadFile" runat="server" Text="Upload file video" GroupName="upload"
                            Checked="true" AutoPostBack="true" OnCheckedChanged="rdbUploadFile_CheckedChanged" />
                        <asp:RadioButton ID="rdbUploadURL" runat="server" Text="Upload URL video" GroupName="upload"
                            AutoPostBack="true" OnCheckedChanged="rdbUploadURL_CheckedChanged" />
                    </div>
                    <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                        <span style="color: #555; float: left; display: block; width: 100px">URL Video:</span>
                        <asp:TextBox ID="txtURLVideo" Text="" runat="server" Width="200px" CssClass="textbox"
                            Style="float: left"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Sai định dạng url"
                            ControlToValidate="txtURLVideo" ValidationExpression="(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?"
                            Display="Dynamic" ValidationGroup="Video">*
                        </asp:RegularExpressionValidator>
                    </div>
                    <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                        <span style="color: #555; float: left; display: block; width: 100px">Upload Video:</span>
                        <asp:FileUpload ID="fuVideo" runat="server" />
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Vị trí:</span>
                <asp:TextBox ID="txtDisplayOrder" runat="server" Width="200px" CssClass="textbox"
                    Text="0" Style="float: left"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Chưa nhập vị trí cho video"
                    ControlToValidate="txtDisplayOrder" ValidationGroup="Video" Display="Dynamic">*</asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtDisplayOrder"
                    Type="Integer" MinimumValue="0" MaximumValue="9999" ValidationGroup="Video" ErrorMessage="Vị trí phải từ 0 đến 9999"
                    Display="Dynamic">*</asp:RangeValidator>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                    Meta Description:</span>
                <div style="float: left;">
                    <asp:TextBox ID="txtMetaDescription" runat="server" Height="100px" TextMode="MultiLine"
                        Width="240px"></asp:TextBox>
                </div>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px; line-height: 100px">
                    Meta Keywords:</span>
                <div style="float: left;">
                    <asp:TextBox ID="txtMetaKeywords" runat="server" Height="100px" TextMode="MultiLine"
                        Width="240px"></asp:TextBox>
                </div>
            </div>
            <div style="float: left; text-align: left; margin-bottom: 5px; padding-left: 100px">
                <asp:CheckBox ID="chkIsActive" runat="server" Text="Kích hoạt" Checked="true" />
                <asp:CheckBox ID="chkTop" runat="server" Text="Nổi bật" />
            </div>
            <div style="float: left; text-align: left; margin-bottom: 5px; padding-left: 100px">
                <asp:CheckBox ID="chkCommentsEnable" runat="server" Text="Bình luận" />
                <asp:CheckBox ID="chkApprovedComments" runat="server" Text="Tự động duyệt bình luận" />
            </div>
            <div style="float: left; text-align: left; margin-bottom: 5px; padding-left: 100px">
                <asp:CheckBox ID="chkOnlyForMember" runat="server" Text="Dành cho thành viên" />
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Đánh giá:</span>
                <asp:Label ID="lblTotalRating" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: left; margin-bottom: 5px">
                <span style="color: #555; float: left; display: block; width: 100px">Lượt xem:</span>
                <asp:Label ID="lblTotalViews" runat="server" Text="None"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: center;">
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List"
                    Font-Bold="True" Font-Size="11px" ForeColor="Red" ValidationGroup="Video" />
                <asp:Label ID="lblMsg" runat="server" Text="" ForeColor="Red" Font-Bold="true"></asp:Label>
            </div>
            <div style="float: left; width: 100%; text-align: center;">
                <asp:Button ID="btnSave" runat="server" Text="Lưu" Width="100px" CommandName="Insert"
                    ValidationGroup="Video" OnClick="btnSave_Click" />
                &nbsp;<asp:Button ID="btnCancel" runat="server" Text="Thêm mới" Width="100px" Visible="False"
                    OnClick="btnCancel_Click" />
                &nbsp;<asp:Button ID="btnDeleteVideo" runat="server" Text="Xoá" Width="100px" Visible="False"
                    OnClick="btnDeleteVideo_Click" />
            </div>
        </div>
        <div style="float: left;">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="txtSearch" runat="server" Width="180" CssClass="Textbox" Style="margin-bottom: 5px"></asp:TextBox>
                    <asp:DropDownList runat="server" ID="ddlCategories2" Width="130px" AppendDataBoundItems="true">
                        <asp:ListItem Text="[Tất cả]" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:Button runat="server" ID="btnSearch" Text="Tìm kiếm" OnClick="btnSearch_Click" />
                    <asp:GridView ID="grvVideoClip" CssClass="grid" runat="server" AutoGenerateColumns="False"
                        GridLines="None" Width="400px" AllowPaging="true" AllowSorting="true" ToolTip="all"
                        PageSize="15" OnDataBinding="grvVideoClip_DataBinding" OnPageIndexChanging="grvVideoClip_PageIndexChanging"
                        OnSorting="grvVideoClip_Sorting">
                        <Columns>
                            <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px">
                                <HeaderTemplate>
                                    <input id="chkAll" type="checkbox" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <input id="chkSelect" runat="server" class="checkbox" type="checkbox" title='<%# Eval("VideoID") %>' />
                                </ItemTemplate>
                                <HeaderStyle Width="20px" />
                                <ItemStyle HorizontalAlign="Center" Width="20px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="150" HeaderText="Video clip"
                                ItemStyle-HorizontalAlign="left" ItemStyle-Width="150" SortExpression="Title">
                                <ItemTemplate>
                                    <asp:Label ID="lblTitleVideo" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" Width="150"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left" Width="150"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="100" HeaderText="Danh mục"
                                ItemStyle-HorizontalAlign="left" ItemStyle-Width="100" SortExpression="CateName">
                                <ItemTemplate>
                                    <asp:Label ID="lblCateVideo" runat="server" Text='<%# Eval("CateName") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Left" Width="100px"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-Width="50" HeaderText="Ngày đăng"
                                ItemStyle-HorizontalAlign="left" ItemStyle-Width="50" SortExpression="AddedDate">
                                <ItemTemplate>
                                    <asp:Label ID="lblAddedDate" runat="server" Text='<%# String.Format("{0:dd/MM/yyyy HH:mm:ss tt}", (DateTime)(Eval("AddedDate")))%>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" Width="50px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Kích hoạt" ItemStyle-HorizontalAlign="Center" SortExpression="IsActive">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkActive" runat="server" Checked='<%#Eval("IsActive")%>' Enabled="false" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Vị trí" ItemStyle-HorizontalAlign="Center" SortExpression="DisplayOrder">
                                <ItemTemplate>
                                    <asp:Label ID="lblDisplayOrder" runat="server" Text='<%#Eval("DisplayOrder")%>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" Width="30px"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="20px"
                                ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imbEdit" runat="server" ImageUrl="~/WebmasterTool/Images/Edit.gif"
                                        CausesValidation="false" CommandArgument='<%# Eval("VideoID") %>' CommandName="View"
                                        OnCommand="imbEdit_Command" OnDataBinding="imbEdit_DataBinding"></asp:ImageButton>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Center" Width="20px"></HeaderStyle>
                                <ItemStyle HorizontalAlign="Center" Width="20px"></ItemStyle>
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                            <table align="center" width="300" border="0">
                                <tr>
                                    <td height="50" align="center">
                                        <div align="center">
                                            Không có dữ liệu
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <PagerSettings Mode="NumericFirstLast" />
                    </asp:GridView>
                    <asp:Button runat="server" ID="btnDelete" Text=" Xoá mục đã chọn " OnClick="btnDelete_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="btnDelete" />
                </Triggers>
            </asp:UpdatePanel>
        </div>
    </asp:Panel>
</asp:Content>
